<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ page import="com.scalar.chiptrack.commons.Constants" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<chiptrack:checkLogon sourcePage="/inventorypsSearch.do"/>
<%
	String chipTracContext = "/" + ConfigManager.getChipTracContext();
    String userTypeChiptrac = Constants.USER_TYPE_CHIPTRAC + "";
%>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/quickSearch.js"></script>
<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<script language="javascript">
var listSize = 0;
window.onload = init;
function init()
{
    if ( document.inventoryPackingSlipForm.processStepId  != null)
    {
        qs_1 = new QuickSearch( document.inventoryPackingSlipForm.processStepId, document.inventoryPackingSlipForm.qs1, false);
    }
    if ( document.inventoryPackingSlipForm.lotId  != null)
    {
        qs_2 = new QuickSearch( document.inventoryPackingSlipForm.lotId, document.inventoryPackingSlipForm.qs2, false);
    }
}

function selectProcessType()
{
    var form = document.inventoryPackingSlipForm;

    if( form.processType.value == 0 )
    {
        form.action.value = 'processTypes';
        form.submit();
        return;
    }
    if ( form.processStepId != null )
    {
        form.processStepId.value = 0;
    }
    if ( form.locationId != null )
    {
        form.locationId.value = 0;
    }
    if ( form.lotId != null )
    {
        form.lotId.value = 0;
    }
    form.action.value="search";
    form.submit();
 }

 function save()
{

    var pa=document.getElementById("message");

    pa.innerHTML                = '';
    var form                    = document.inventoryPackingSlipForm;
    var count1                  = 0;

    for( var i=0; i < listSize; i++ )
    {
        if( form['availableLotsList['+i+'].checked'].checked == true )
        {
			count1++;
        }
    }

    if( count1==0 )
	{
		pa.innerHTML = "<li> Please select atleast one lot";
		return;
	}
    form.action.value = "save";
    form.submit();
}

function reset()
{
    document.inventoryPackingSlipForm.reset();
    qs_1.resetQuickSearchCntrl();
    qs_2.resetQuickSearchCntrl();
}

function searchLots()
{
    var form = document.inventoryPackingSlipForm;

    form.action.value="lotNumbers";
    form.submit();
}

function searchLotsOnSubmit()
{
     var form = document.inventoryPackingSlipForm;

    form.action.value="lotNumbers";
    form.submit();
}

function createNewPackingSlip()
{
	var pa=document.getElementById("message");
    pa.innerHTML                = '';
	var form = document.inventoryPackingSlipForm;
    var count1                  = 0;

    for( var i=0; i < listSize; i++ )
    {
        if( form['availableLotsList['+i+'].checked'].checked == true )
        {             
			count1++;
        }
    }
	
	if( count1==0 )
	{
		pa.innerHTML = "<li> Please select atleast one lot";
		return;
	}

	if( form.locationId.value == 0 )
	{
		pa.innerHTML = "<li> Please select from Location";
		return;
	} 

	if( form.toVendorId.value == 0 )
	{
		pa.innerHTML = "<li> Please select ship to Location";
		return;
	} 
		
    form.action.value = "generateps";
    form.submit();
}


</script>
<!-- Top Header Start-->
<logic:equal value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
	<%@ include file="/jsp/includes/header.jsp" %>
</logic:equal>
<logic:notEqual value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
	<%@ include file="/jsp/includes/extHeader.jsp" %>
</logic:notEqual>
<!-- Top Header End-->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
	<TBODY>
	<TR>
		<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
		<!-- Side Navigation start -->
	    <logic:equal value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
		    <%@ include file="/jsp/operations/dataentryMenu.jsp" %>
		</logic:equal>
		<logic:notEqual value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
			<%@ include file="/jsp/operations/ext_user_dataentryMenu.jsp" %>
		</logic:notEqual>
		<!-- end of the side navigations -->
		<TD bgcolor="#ffffff">
			<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
		<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
		<TD valign="top" width="100%">
		<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
		<BR>
		<html:form name="inventoryPackingSlipForm" method = "POST"  type="com.scalar.chiptrack.operations.inventoryps.forms.InventoryPackingSlipForm" action="/inventoryps" >
		<input type="hidden" name="action" value="<%= (String)request.getAttribute("action")%>">
		<TABLE border="0" width="100%" align=center>
			<TR><TD colspan=5 class="NArialW" align="center">New Inventory Packing Slip</TD><TD width="25%" class="NArialL">&nbsp;</TD></TR>
			<TR><TD colspan=6>&nbsp;</TD></TR>
			<TR><TD colspan=6 class='NArialL'><strong><FONT id="message" styleClass="NArialL" color='FF0000'></FONT></strong></TD></TR>
			<TR><TD colspan=5>
			<chiptrack:info  styleClass="NArialL" />
			<chiptrack:errors styleClass="NArialL" />
			<chiptrack:messages type="info" styleClass="NArialL" />
			</TD><TD width="25%" class="NArialL">&nbsp;</TD>
			</TR>
			<logic:equal name="showMessage" value="TRUE">
					<tr><td colspan=6 align='left'><font class='NArialS'color='blue'><b><%=Constants.NO_MODIFY_RIGHTS %></b></font></TD></TR>
			</logic:equal>

			<TR>
				<TD>
					<TABLE  border="0" width="100%" cellpadding="1" cellspacing="1">
						<TR>
					        <logic:present name="processTypeList" scope="request">
								<TD width="10%" class="NArialL">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
								<TD width="20%" nowrap class="NArialL">Process Type:<font color= "red">*</font></TD>
								<TD width="20%" class="NArialL">
									<html:select property="processType" name="inventoryPackingSlipForm" styleClass="txfield" onchange="selectProcessType()" >
										<html:option value="0">Select Process Type</html:option>
										<html:options collection="processTypeList" property="value" labelProperty="label"/>
									</html:select>
                                    <%--<html:hidden property="processType" name="inventoryPackingSlipForm"/>--%>
								</TD>
							</logic:present>
							<logic:notPresent name="processTypeList" scope="request">
								<TD width="10%" class="NArialL">&nbsp;</TD>
								<TD width="20%" class="NArialL">&nbsp;</TD>
								<TD width="25%" class="NArialL">&nbsp;</TD>
					        </logic:notPresent>
						  <TD width="15%" class="NArialL">&nbsp;</TD>
						  <TD width="15%" class="NArialL">&nbsp;</TD>
						  <TD width="20%" class="NArialL">&nbsp;</TD>
					    </TR>
 						<TR>
							<TD colspan="6"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></TD>
					    </TR>
					    <logic:present name="partNumbersList"  scope="request">
						    <TR>
								<TD width="10%" class="NArialL">&nbsp;</TD>
								<TD class="NArialL" width='20%'>Quick Search:</TD>
								<td class="NArialL" width='20%'>
							        <input type="text" name="qs1" class="txfield" size='23' onkeyup='quickSearch(qs_1)'/>
								</td>
						        <TD COLSPAN=3>&nbsp;</TD>
						    </TR>
					    </logic:present>
						<TR>
							<logic:present name="partNumbersList"  scope="request">
								<TD width="10%" class="NArialL">&nbsp;</TD>
								<TD width="20%" class="NArialL">Product Name: </TD>
								<TD width="20%" class="NArialL">
								<html:select property="processStepId"  name="inventoryPackingSlipForm" styleClass="txfield">
								<html:option value="0">Select Part Number</html:option>
								<html:options collection="partNumbersList" property="value" labelProperty="label"/>
								</html:select>
							</TD>
						</logic:present>
						<logic:notPresent name="partNumbersList" scope="request">
							<TD width="10%" class="NArialL">&nbsp;</TD>
							<TD width="20%" class="NArialL">&nbsp;</TD>
							<TD width="20%" class="NArialL">&nbsp;</TD>
						</logic:notPresent>

						<logic:present name="locationList" scope="request">
							<TD width="15%" nowrap class="NArialL">From Location:</TD>
							<TD width="15%" class="NArialL">
								<html:select property="locationId" name="inventoryPackingSlipForm" styleClass="txfield">
									<html:option value="0">Select From Location</html:option>
									<html:options collection="locationList" property="value" labelProperty="label"/>
								</html:select>
							</TD>
							<TD width="20%" class="NArialL">&nbsp;</TD>
						</logic:present>
						<logic:notPresent name="locationList" scope="request">
							<TD width="15%" class="NArialL">&nbsp;</TD>
							<TD width="15%" class="NArialL">&nbsp;</TD>
							<TD width="20%" class="NArialL">&nbsp;</TD>
					   </logic:notPresent>
					</TR>
					<TR>
						<TD colspan="6"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></TD>
					</TR> 
					<logic:present name="lotsList" scope="request">
						<TR>
							<TD width="10%" class="NArialL">&nbsp;</TD>
							<TD class="NArialL" width='20%'>Quick Search:</TD>
							<td class="NArialL" width='20%'>
							<input type="text" name="qs2" class="txfield" size='23' onkeyup='quickSearch(qs_2)'/>
							</td>
							<TD COLSPAN=2>&nbsp;</TD>
						</TR>
					</logic:present>
 					<TR>
						<logic:present name="lotsList" scope="request">
							<TD width="10%" class="NArialL">&nbsp;</TD>
							<TD width="20%" class="NArialL">Lot Number:</TD>
							<TD width="20%" class="NArialL">
								<html:select property="lotId" name="inventoryPackingSlipForm" styleClass="txfield">
								<html:option value="0">Select Lot Number</html:option>
								<html:options collection="lotsList" property="lotId" labelProperty="lotNumber"/>
								</html:select>
							</TD>
							<TD width="15%" nowrap class="NArialL">To Location:</TD>
							<TD width="15%" class="NArialL">
								<html:select property="toVendorId" name="inventoryPackingSlipForm" styleClass="txfield">
									<html:option value="0">Select To Location</html:option>
									<html:options collection="toLocationList" property="vendorId" labelProperty="vendorName"/>
								</html:select>
							</TD>
							<TD width="20%" class="NArialL">&nbsp;</TD>

						</logic:present>
						<logic:notPresent name="lotsList" scope="request">
							<TD width="10%" class="NArialL">&nbsp;</TD>
							<TD width="20%" class="NArialL">&nbsp;</TD>
							<TD width="20%" class="NArialL">&nbsp;</TD>
						</logic:notPresent>

						<TD width="15%" class="NArialL">&nbsp;</TD>
						<TD width="15%" class="NArialL">&nbsp;</TD>
						<TD width="20%" class="NArialL">&nbsp;</TD>
				   </TR> 
				   <TR>
						<TD colspan="6"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></TD>
				   </TR>
				   <logic:present name="partNumbersList">
					   <TR>
							<td colspan="6" align="center">
								<a href="javascript:searchLots()"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17" onmouseover="window.status='Click to Search for Inventory Packing Slip Lots';return true" onmouseout="window.status='';return true"title="Click to Search for Inventory Packing Slip Lots"/></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								<a href="javascript:reset();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17" onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a>
							</td>
						</TR>
					</logic:present>
			    </TABLE>
			</TD>
		</TR>

	</TABLE>
	<nested:present property="availableLotsList">
	<nested:size id="LotsSize" property="availableLotsList"/>
	<logic:greaterThan name="LotsSize" value="0">
	<table width="100%" align="left" cellpadding="2" cellspacing="2" border="0">
		<tr>
            <td colspan="1">&nbsp;</td>
			<td colspan="9" class='NArialL'><a href="javascript:createNewPackingSlip()" class="leftsection" onMouseOver="window.status='Click to generate Packing Slip';return true" onMouseout="window.status='';return ">Click here</a> to generate Inventory Packing Slip for selected lots</td>
		</tr>
        <TR>
            <TD COLSPAN="13"><IMG SRC="<%=chipTracContext%>/jsp/includes/images/spacer.gif" HEIGHT=10></TD>
        </TR>
		<tr>
			<td colspan="10"class='NArialL'><font class='NArialS'><font color='blue'>[Click on Select checkbox to Create Packing Slip ]</font></font></td>
		</tr>
		<tr bgcolor="#993333" align = "center">
			<td class='NArialL'><font color="#FFFFFF">Select </font></td>
			<td class='NArialL' nowrap><font color="#FFFFFF">Part Number</font></td>
			<td class='NArialL' nowrap><font color="#FFFFFF">Lot No#</font></td>
			<td class='NArialL' nowrap><font color="#FFFFFF">FabLot No#</font></td>
			<td class='NArialL'><font color="#FFFFFF">Vendor</font></td>
			<td class='NArialL'><font color="#FFFFFF">Qty In</font></td>
			<td class='NArialL'><font color="#FFFFFF">Date In</font></td>
			<logic:equal name="showWaferIds" value="TRUE">
				<td class='NArialL'><font color="#FFFFFF">Wafer Ids</font></td>
			</logic:equal>
		</tr>
    <nested:size id="listSize" property="availableLotsList"/>
    <nested:iterate id="lotDetails" property="availableLotsList" indexId="iterateIdx" type = "com.scalar.chiptrack.operations.dataentry.LotDetails">

    <tr bgcolor='<%=iterateIdx.intValue() % 2 == 0 ? "#FFFFEE" : "#DEE1E2"%>'>
        <td width ="3%" align="center" class='NArialL' ><nested:checkbox  name="lotDetails" property ="checked"/></td>
        <td class='NArialL'><nested:write name="lotDetails" property ="partNumber"/></td>
        <td class='NArialL'><nested:write name="lotDetails" property ="lotNumber"/></td>
        <td class='NArialL'><nested:write name="lotDetails" property ="fabLotNumber"/></td>
        <td class='NArialL'><nested:write name="lotDetails" property ="vendorName"/></td>
        <logic:equal name="showWaferIds" value="TRUE">
            <logic:equal value="Die Bank" property="processType" name="inventoryPackingSlipForm">
                <td class='NArialL'><nested:write name="lotDetails" property ="dieQtyIn"/></td>
            </logic:equal>
            <logic:notEqual value="Die Bank" property="processType" name="inventoryPackingSlipForm">
	        <td class='NArialL'><nested:write name="lotDetails" property ="waferQtyIn"/></td>
            </logic:notEqual>
		</logic:equal>
        <logic:notEqual name="showWaferIds" value="TRUE">
	        <td class='NArialL'><nested:write name="lotDetails" property ="dieQtyIn"/></td>
		</logic:notEqual>
        <td class='NArialL'><nested:write name="lotDetails" property ="dateIn"/></td>
        <logic:equal name="showWaferIds" value="TRUE">
	        <td class='NArialL'><nested:write name="lotDetails"  property ="waferIds" /></td>
		    <nested:hidden property="checkedWaferIdsAsString"/>
        </logic:equal>
        <nested:hidden property="processStepId"/>
        <nested:hidden property="lotId"/>
    </tr>
    </nested:iterate>
 <script type="text/javascript">
   listSize = <%=listSize.intValue()%>;
</script>

</table>
</logic:greaterThan>
</nested:present>

</html:form>
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>

